<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户列表</title>
</head>
<body>
    <div>
        接收变量
        <br>
        {{ info }}
        <br>
        <h1>用户列表</h1>
        <table border="1">
            <thead>
                <tr>
                    <th>用户名</th>
                    <th>状态</th>
                    <th>创建日期</th>
                </tr>
            </thead>
            {% for user in users %}
            <tr>
                <td>{{ user.username }}</td>
                <td>{{ user.status }}</td>
                <td>{{ user.createdate }}</td>
            </tr>
            {% endfor %}
        </table>
        {#       has_previous/has_next 均为 False,也就是数据不足一页时，Django不会显示分页控件         #}
        <div class="pagination">
            {% if page_obj.has_previous %}
                <a href="?page={{ page_obj.previous_page_number }}">上一页</a>
            {% endif %}

            <span>第 {{ page_obj.number }} 页 / 共 {{ page_obj.paginator.num_pages }} 页</span>

            {% if page_obj.has_next %}
                <a href="?page={{ page_obj.next_page_number }}">下一页</a>
            {% endif %}
        </div>
    </div>
</body>
<style>
        .pagination {
            margin: 20px 0;
            text-align: center;
        }
        .pagination a {
            display: inline-block;
            padding: 8px 16px;
            background: #4CAF50;
            color: white;
            text-decoration: none;
            border-radius: 4px;
            margin: 0 5px;
        }
        .pagination a:hover {
            background: #45a049;
        }
    </style>
</html>